/********************************************************/
/*	Copyright (C) 2016 Gong Li Bin		 	*/
/*	Project:	GlbRtbEng-1.0.0			*/
/*	Author:		gong_libin			*/
/*	Date:		2016_06_26			*/
/*	File:		GlbRtbBase.cpp			*/
/********************************************************/

#include "GlbRtbBase.h"

void CGlbRtbBase::GlbRtbBaseZero()
{
	m_CSet.GlbSetPutCount(0);

	return;
}

void CGlbRtbBase::GlbRtbBaseDelete()
{
	m_CShm.GlbIpcDelete();

	return;
}

void CGlbRtbBase::GlbRtbBaseReset(UINT uiSum)
{
	m_CSet.GlbSetReset(uiSum);

	return;
}

int CGlbRtbBase::GlbRtbBaseCreate(key_t iKey, UINT uiSum, UINT uiSize, GlbCls::GlbSetCompPtr pComp)
{
	int iReturn =  GLB_SUCCESS;

	if (GLB_SUCCESS == m_CShm.GlbIpcCreate(iKey, uiSum * uiSize)) {
		m_CSet.GlbSetPutSet(m_CShm.GlbShmGetShm());
		m_CSet.GlbSetPutSize(uiSize);
		m_CSet.GlbSetCompare(pComp);
	}
	else {
		iReturn = GLB_FAILURE;
	}

	return iReturn;
}
